/*
	This file is part of AVRCppLib.

    AVRCppLib is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    AVRCppLib is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with AVRCppLib.  If not, see <http://www.gnu.org/licenses/>.

    Copyright (C) Maxime Lemonnier 2007-2011
 */

#ifndef ANALOGTODIGITALINTERFACECOMPATIBILITY_H_
#define ANALOGTODIGITALINTERFACECOMPATIBILITY_H_
#include "../ADCHardware.h"
#include <avr/interrupt.h>




#ifndef ADATE
	#define ADATE ADFR
#endif


#ifdef __AVR_ATmega1280__

#define ADC_vect_number 	29

#endif

#ifdef __AVR_ATtiny45__

#define ADC_vect_number 	8

#endif

#ifdef __AVR_ATmega16__

#define TRIGGER_REG 	SFIOR
#define TRIGGER_MASK	buildMask(ATDS0, ADTS1, ADTS2)
#define INTERNAL_VOLTAGE 2.56f

namespace Triggers
{

	/*!
	 * Trigger sources for trigger
	 */
	enum Trigger
	{
		MANUAL,
		FREE_RUNNING,
		ANALOG_COMPARATOR,
		EXTERNAL_INTERRUPT_0,
		TIMER0_COMPARE_MATCH,
		TIMER0_OVERFLOW,
		TIMER1_COMPARE_MATCH,
		TIMER1_OVERFLOW
	};

}


#endif


#ifdef __AVR_ATmega128__

#define TRIGGER_REG 	SFIOR
#define TRIGGER_MASK	0x00
#define INTERNAL_VOLTAGE 2.56f

namespace Triggers
{

	/*!
	 * Trigger sources for trigger
	 */
	enum Trigger
	{
		MANUAL,
		FREE_RUNNING
	};

}

#endif /* __AVR_ATmega128__ */

#endif /*ANALOGTODIGITALCOMPATIBILITY_H_*/
